DRIVERS-y :=
DRIVERS-y += arch/s5pv210.o
DRIVERS-y += drivers/store/store.o
DRIVERS-y += init/init.o
DRIVERS-y += lib/s5pv_lib.o
DRIVERS-y += drivers/net_phy/phy.o
DRIVERS-y += net/tftp/net_tftp.o
DRIVERS-y += drivers/mtd/mtd.o
DRIVERS-y += drivers/usb/usb_fastboot.o
DRIVERS-y += drivers/sd/sd.o
DRIVERS-y += drivers/lcd/lcd.o
DRIVERS-y += fatfs/fatop.o

objs 	:= $(DRIVERS-y)

TOPDIR	:= $(shell /bin/pwd)

CROSSTOOLDIR 	:= /usr/local/arm/4.3.2
CROSS_COMPILE   = $(CROSSTOOLDIR)/bin/arm-linux-
CC          	= $(CROSS_COMPILE)gcc
LD          	= $(CROSS_COMPILE)ld
OBJCOPY     	= $(CROSS_COMPILE)objcopy
OBJDUMP     	= $(CROSS_COMPILE)objdump
NM		     	= $(CROSS_COMPILE)nm

DIR_INCLUDE	=	-I$(TOPDIR)/include

LINKFLAGS 	= 	-Tarch/edu-boot.lds -Bstatic

CLIBSDIR	= $(CROSSTOOLDIR)/arm-none-linux-gnueabi/libc/armv4t/usr/lib
GCCLIBSDIR	= $(CROSSTOOLDIR)/lib/gcc/arm-none-linux-gnueabi/4.3.2/armv4t
ARMLIBS 	= -L$(CLIBSDIR) -lc -L$(GCCLIBSDIR) -lgcc

export CC LD OBJCOPY OBJDUMP DIR_INCLUDE TOPDIR

edu-boot.bin :subdirs $(objs)
	$(LD) -v $(LINKFLAGS) -o edu-boot_elf $(objs) $(ARMLIBS)
	$(OBJCOPY) -O binary -S edu-boot_elf $@
	$(OBJDUMP) -D -m arm  edu-boot_elf > edu-boot.dis
	$(NM) -v -l edu-boot_elf > edu-boot.map
	./tools/mksmdkv210spl.sh edu-boot.bin
	
clean: 
	find -name '*.o' | xargs rm -f
	rm -f edu-boot.dis edu-boot.map edu-boot_elf edu-boot.bin ./tools/edu-boot.bin

del_mksmdkv210spl:
	rm -f ./tools/mksmdkv210spl
	
include Rules.make
